<!--
Copyright 2017 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<kd-content-card>
  <kd-content>
    <kd-resource-card-list selectable="false"
                           with-statuses="true">
      <kd-resource-card-list-header>
        <kd-resource-card-list-title>
          [[Created by|Heading for Creator card on pod detail page.]]
        </kd-resource-card-list-title>
      </kd-resource-card-list-header>

      <kd-zero-state ng-if="!$ctrl.creator.typeMeta.kind">
        <kd-zero-state-text>
          [[This Pod does not have a creator.|Text for pod creator zero state in pod details page.]]
        </kd-zero-state-text>
      </kd-zero-state>
      <kd-resource-card-header-columns ng-show="$ctrl.creator.typeMeta.kind">
        <kd-resource-card-header-column size="small"
                                        grow="2">
          [[Name|Label 'Name' which appears as a column label in the creator card.]]
        </kd-resource-card-header-column>
        <kd-resource-card-header-column size="small"
                                        grow="1">
          [[Kind|Label 'Kind' which appears as a column label in the creator card.]]
        </kd-resource-card-header-column>
        <kd-resource-card-header-column size="small"
                                        grow="2"
                                        ng-if="$ctrl.areMultipleNamespacesSelected()">
          [[Namespace|Label 'Namespace' which appears as a column label in the creator card.]]
        </kd-resource-card-header-column>
        <kd-resource-card-header-column size="small"
                                        grow="2">
          [[Labels|Label 'Labels' which appears as a column label in the creator card.]]
        </kd-resource-card-header-column>
        <kd-resource-card-header-column size="small"
                                        grow="1">
          [[Pods|Label 'Pods' which appears as a column label in the creator card.]]
        </kd-resource-card-header-column>
        <kd-resource-card-header-column size="small"
                                        grow="1">
          [[Age|Label 'Age' which appears as a column label in the creator card.]]
        </kd-resource-card-header-column>
        <kd-resource-card-header-column size="small"
                                        grow="2">
          [[Images|Label 'Images' which appears as a column label in the creator card.]]
        </kd-resource-card-header-column>
        <kd-resource-card-header-column size="small"
                                        grow="nogrow">
        </kd-resource-card-header-column>
      </kd-resource-card-header-columns>

      <kd-resource-card ng-if="$ctrl.creator.typeMeta.kind"
                        object-meta="$ctrl.creator.objectMeta"
                        type-meta="$ctrl.creator.typeMeta">
        <kd-resource-card-status layout="row">
          <md-icon class="material-icons md-warn"
                   ng-if="::$ctrl.hasWarnings()">
            error
            <md-tooltip md-delay="500"
                        md-autohide>
              One or more pods have errors
            </md-tooltip>
          </md-icon>
          <md-icon class="material-icons"
                   ng-if="::$ctrl.isPending()">
            timelapse
            <md-tooltip md-delay="500"
                        md-autohide>
              One or more pods are in pending state
            </md-tooltip>
          </md-icon>
          <md-icon class="material-icons kd-success"
                   ng-if="::$ctrl.isSuccess()">
            check_circle
          </md-icon>
        </kd-resource-card-status>
        <kd-resource-card-columns>
          <kd-resource-card-column>
            <div>
              <a ng-href="{{::$ctrl.getCreatorDetailHref()}}"
                 class="kd-middle-ellipsised-link">
                <kd-middle-ellipsis display-string="{{$ctrl.creator.objectMeta.name}}">
                </kd-middle-ellipsis>
              </a>
            </div>
          </kd-resource-card-column>
          <kd-resource-card-column>
            {{::$ctrl.creator.typeMeta.kind}}
          </kd-resource-card-column>
          <kd-resource-card-column ng-if="$ctrl.areMultipleNamespacesSelected()">
            <div>
              <kd-middle-ellipsis display-string="{{::$ctrl.creator.objectMeta.namespace}}">
              </kd-middle-ellipsis>
            </div>
          </kd-resource-card-column>
          <kd-resource-card-column>
            <kd-labels labels="::$ctrl.creator.objectMeta.labels"></kd-labels>
          </kd-resource-card-column>
          <kd-resource-card-column>
            <span class="kd-replicase-card-pods-stat">
        {{::$ctrl.creator.pods.running}} <span ng-if="$ctrl.creator.pods.desired != null">/ {{::$ctrl.creator.pods.desired}}</span>
      </span>
          </kd-resource-card-column>
          <kd-resource-card-column>
            {{::$ctrl.creator.objectMeta.creationTimestamp | relativeTime}}
            <md-tooltip md-delay="500"
                        md-autohide>
              Created at {{::$ctrl.creator.objectMeta.creationTimestamp | date}}
            </md-tooltip>
          </kd-resource-card-column>
          <kd-resource-card-column>
            <div ng-repeat="image in ::$ctrl.creator.containerImages track by $index">
              <kd-middle-ellipsis display-string="{{::image}}"></kd-middle-ellipsis>
            </div>
          </kd-resource-card-column>
          <kd-resource-card-column class="kd-row-layout-column kd-icon-column">
            <kd-resource-card-menu>
              <kd-resource-card-delete-menu-item resource-kind-name="{{::$ctrl.creator.typeMeta.kind}}">
              </kd-resource-card-delete-menu-item>
            </kd-resource-card-menu>
          </kd-resource-card-column>
        </kd-resource-card-columns>
        <kd-resource-card-footer ng-if="::$ctrl.hasWarnings()">
          <kd-pod-warnings warnings="::$ctrl.creator.pods.warnings"></kd-pod-warnings>
        </kd-resource-card-footer>
      </kd-resource-card>

    </kd-resource-card-list>
  </kd-content>
</kd-content-card>
